import { Navigate, Route, createBrowserRouter, createRoutesFromElements } from "react-router-dom";
import App from "../App";
import SignIn from "../pages/signin";
import FolderTree from "../components/FolderTree/FolderTree";
import SharePage from "../pages/share/Share";
import { sharedFileLoader } from "../pages/share/shareLoader";
import { Box } from "@mui/material";
import FilePanel from "../components/FilePanel/FilePanel";
import SharedPanel from "../components/SharedPanel/SharedPanel";
import { sharedPanelLoader } from "../components/SharedPanel/SharedPanelLoader";
import { Fragment } from "react";
import TestWorker from "../components/TestWorker/TestWorker";
import SignUp from "../pages/SignUp/SignUp";
const router = createBrowserRouter(
  createRoutesFromElements(
    <Fragment>
      <Route path="/" element={<Navigate to={"/app/file"} replace />}></Route>
      <Route path="app" element={<App/>} >
        <Route path="file" element={<FilePanel/>} />
        <Route path="shared" loader={sharedPanelLoader} element={ <SharedPanel/> } />
        <Route path="recyclebin" element={<Box>recyclebin</Box>} />
      </Route>
      <Route path="test" element={<TestWorker />} />
      <Route path="signin" element={<SignIn />} />
      <Route path="signup" element={<SignUp />} />
      <Route path="share/:sharedId"  loader={sharedFileLoader} element={<SharePage />} />
    </Fragment>
  ));


export default router;
